package com.ternnetwork.commons.model.http;

import java.io.Serializable;

import com.ternnetwork.commons.utils.JsonUtils;


/**
 * 
 * @author xuwenfeng
 *
 */

public class BaseResponse implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2941805091782099901L;

	private Integer status;
	
	private String message;
	
	private String processTime;
	
	private Object data;

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	@Override
	public String toString() {
		return JsonUtils.objectToJson(this);
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
	public void setSccucess() {
		this.status=BaseResponseStatus.SCCUCESS.getIndex();
		this.message=BaseResponseStatus.SCCUCESS.getName();
	}
	
	public void setSccucess(Object data) {
		this.status=BaseResponseStatus.SCCUCESS.getIndex();
		this.message=BaseResponseStatus.SCCUCESS.getName();
		this.data = data;
	}
	
	public void setFailed() {
		this.status=BaseResponseStatus.FAILED.getIndex();
		this.message=BaseResponseStatus.FAILED.getName();
	}
	
	public void setFailedForObjectNotExist() {
		this.status=BaseResponseStatus.FAILED_OBJECT_NOT_EXIST.getIndex();
		this.message=BaseResponseStatus.FAILED_OBJECT_NOT_EXIST.getName();
	}

	public void setFailedForObjectNotBelongsToLoginUser() {
		this.status=BaseResponseStatus.FAILED_OBJECT_NOT_BELONGS_TO_LOGIN_USER_EXIST.getIndex();
		this.message=BaseResponseStatus.FAILED_OBJECT_NOT_BELONGS_TO_LOGIN_USER_EXIST.getName();
	}
	public void setFailed(String message) {
		this.status=BaseResponseStatus.FAILED.getIndex();
		this.message=message;
	}

	public String getProcessTime() {
		return processTime;
	}

	public void setProcessTime(String processTime) {
		this.processTime = processTime;
	}

	

}
